package com.supor.aiot.mine.ui.setting;

import android.content.Intent;
import android.net.Uri;
import android.view.View;

import com.supor.aiot.common.base.BaseMVVMActivity;
import com.supor.aiot.common.base.NoViewModel;
import com.supor.aiot.mine.R;
import com.supor.aiot.mine.databinding.ActivitySystemPermissionBinding;

public class SystemPermissionActivity extends BaseMVVMActivity<NoViewModel, ActivitySystemPermissionBinding> implements View.OnClickListener {

    @Override
    protected int resourceId() {
        return R.layout.activity_system_permission;
    }

    @Override
    protected void initView() {
        super.initView();
        bindingView.toolbar.setIvLeftOnClickListener(v -> finish());
        bindingView.toolbar.setTvLeftOnClickListener(v -> finish());

        bindingView.rlPermissionCamera.setOnClickListener(this);
        bindingView.tvPermissionCameraDetail.setOnClickListener(this);
        bindingView.rlPermissionPhoto.setOnClickListener(this);
        bindingView.tvPermissionPhotoDetail.setOnClickListener(this);
        bindingView.rlPermissionLocation.setOnClickListener(this);
        bindingView.tvPermissionLocationDetail.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        /*int id = view.getId();
        if (id == R.id.rl_permission_camera) {

        } else if (id == R.id.rl_permission_photo) {

        } else if (id == R.id.rl_permission_location) {

        }*/
        Intent localIntent = new Intent();
        localIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        localIntent.setAction("android.settings.APPLICATION_DETAILS_SETTINGS");
        localIntent.setData(Uri.fromParts("package", getPackageName(), null));
        startActivity(localIntent);
    }
}